﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Grocery
{
    class Program
    {

        static void Main(string[] args)
        {
            string fileName = @"c:\temp\input.txt";
            using (StreamReader sr = new StreamReader(new FileStream(fileName, FileMode.Open)))
            {
                string firstLine = sr.ReadLine();

                Store store = new Store(Int32.Parse(firstLine));
                
                List<Customer> list = new List<Customer>();
                int number = 0;
                while (!sr.EndOfStream)
                {
                    list.Add(CustomerFactory.MakeCustomer(++number, sr.ReadLine()));
                }

                Console.WriteLine("Finined at: " 
                    + store.Simulate(list).ToString()
                    + " minutes." );
                Console.ReadLine();
            }
        }

    }
}
